home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Floppyshop 2
/
Floppyshop - 2.zip
/
Floppyshop - 2.iso
/
art&graf.ix
/
art-0039
/
source
/
manywind.def
< prev
next >
Wrap
Text File
|
1997-04-16
|
9KB
|
220 lines
DEFINITION MODULE ManyWindows;
(*-----------------------------------------------------------------------*)
(* This is the multi-window version of OneWindow. *)
(* *)
(* This may turn into something considerably more powerful than just *)
(* a multi-window version of OneWindow. I am starting to consider the *)
(* possibility of turning this into a true window handler... *)
(* *)
(* This is still evolving, here are my thoughts on this version... *)
(* *)
(* A window is a DYNAMIC entity; it has states e.g OPEN, CLOSED, TOPPED *)
(* etc. *)
(* *)
(* It will allow up to four seperate windows to be created and *)
(* maintained by an application. Also provided are useful standard *)
(* routines for use by GEM applications. *)
(* *)
(* The following routines are provided: *)
(* o Sign on the application to GEM ( and return the handle. ) *)
(* o Get the VDI handle used by the desktop. *)
(* o Open a virtual workstation for this application. *)
(* o Get the current screen resolution. *)
(* o Terminate an application. *)
(* *)
(* Window functions: *)
(* o Create a window ( up to four ) *)
(* o Return workarea of the given window. *)
(* o Open/close/delete any window *)
(* *)
(* *)
(* *)
(* 7/ 9/89 LGM : Original. *)
(*-----------------------------------------------------------------------*)
FROM Window IMPORT ComponentSet;
FROM Strings IMPORT String;
FROM SYSTEM IMPORT LONGWORD;
TYPE
XYWHRect = RECORD (* normally used by AES *)
CASE :BOOLEAN OF
TRUE : X, Y, Width, Height : CARDINAL; |
FALSE : IntArray : ARRAY [ 0 .. 3 ] OF INTEGER; |
END;
END;
CornersRect = RECORD
CASE :BOOLEAN OF
TRUE : XL, YL, (* lower left corner *)
XR, YR (* upper right corner *) : CARDINAL; |
FALSE: IntArray : ARRAY [ 0 .. 3 ] OF INTEGER;
END
END; (* actually, these can be diagonally opposite corners *)
WindowStates = ( open, full, topped );
WindowSSet = SET OF WindowStates;
FontData =
RECORD
CharWidth, CharHeight, Width, Height : CARDINAL;
END; (* Coordinate *)
RectListDetail = RECORD
Set : BOOLEAN;
First : BOOLEAN;
UpdateRect : XYWHRect;
END;
SliderDetails = RECORD
Position,
Size : [ 0 .. 1000 ];
END;
WindowPtr = POINTER TO AWindow;
AWindow = RECORD
Handle : INTEGER; (* The AES window handle *)
State : WindowSSet;
Outer,
Workarea,
PrevSize : XYWHRect;
Components : ComponentSet;
RectList : RectListDetail;
HorizSlider,
VertSlider : SliderDetails;
Font : FontData;
Title,
Info : String;
END; (* Window *)
VAR
AESApplId : INTEGER; (* AES handle for this application *)
VDIHandle : CARDINAL; (* VDI handle of current Virtual Workstation *)
ScreenResolution : INTEGER;
PROCEDURE ShowAlert( text : ARRAY OF CHAR;
NumberOfButtons : CARDINAL;
DefaultButtonNumber : CARDINAL; ) : CARDINAL;
(* return button number selected *)
PROCEDURE StartApplication;
(* This procedure signs on the application to AES ( GEM ) even if
you do not use any of the AES. This routine also opens a
virtual workstation i.e. it signs you on to the VDI.
The handle returned by AES is put in AESApplId. The handle returned
by the VDI is put in VDIHandle. DON'T mix up which handle is used when,
for AES functions you must only use the AES handle and only use the
VDI handle with vdi functions.
*)
PROCEDURE CreateAWindow( components : ComponentSet ) : WindowPtr;
(* It will set up the record for a window. The Maximum size will be
filled in by this procedure. The workarea size will also be set
*)
PROCEDURE SetAWindowTitle( window : WindowPtr; title : ARRAY OF CHAR );
(* if you have a titlebar you should set up the title before opening
the window. The title is kept in the structure.
*)
PROCEDURE SetAWindowInfo( window : WindowPtr; infoline : ARRAY OF CHAR );
(* if you have an infoline you should set it before opening
the window. The info is kept in the Structure.
*)
PROCEDURE OpenAWindow( window : WindowPtr );
(* Will use the OuterWindow size, This can be less than the values
returned by the CreateAWindow call. If the OuterWindow size is
different from the CreateAWindow size then the Workarea co-ordinates
and size will be automatically re-calculated and updated. *)
PROCEDURE ClearAWindow( window : WindowPtr ) ;
(* Will clear the workarea of the window by drawing a filled rectangle
in the current fill colour. *)
PROCEDURE CloseAWindow( window : WindowPtr );
(* Will remove window from screen -- NOTHING else will be changed.
The window will still exist
with the same components and sizes. *)
PROCEDURE DeleteAWindow( window : WindowPtr );
(* will destroy window -- you can now go through
the Create, set and Open window sequence. *)
PROCEDURE TerminateApplication ; (* You must have done DeleteAWindow
( if you have a window ) before terminating.
This used to be true but AppWindow will now automatically
close and remove the window for you
*)
(*----------------------------------------------------------------------*)
(* Rectangle list procedures *)
(*----------------------------------------------------------------------*)
PROCEDURE SetUpdateRect( wp : WindowPtr; AreaRect : XYWHRect );
PROCEDURE ResetRectList( wp : WindowPtr );
(* next call to GetNextRect will return First Rectangle *)
PROCEDURE GetNextRect( wp : WindowPtr;
VAR UpdateRect : XYWHRect; ) : BOOLEAN;
(* This procedure will return the GEM rectange list for the
window. The return flag indictes that the rectangle needs
to be re-drawn. The rectangle to be updated is returned.
You call this until FALSE is returned.
In : The window you want then next rectangle for.
You must have called SetUpdateRect first.
Out: UpdateRect : The intersection of the update rect
and the window
*)
(*--------------------------------------------------------------------*)
(* various conversion / translation utilities *)
(*--------------------------------------------------------------------*)
PROCEDURE ToXYWHRect( In : CornersRect; VAR Out : XYWHRect );
PROCEDURE ToCornersRect( In : XYWHRect; VAR Out : CornersRect; );
PROCEDURE QueryIntersect( Rect1, Rect2 : XYWHRect;
VAR Intersect : XYWHRect;) : BOOLEAN;
PROCEDURE GetWindowHandle( window : WindowPtr ) : INTEGER;
PROCEDURE GetWindowPtr( handle : INTEGER ) : WindowPtr;
(* These routines will do the call to the window lock routines, but
will keep track of how many times they have been called and and
only free the screen when the count reaches zero. *)
PROCEDURE BeginScreenUpdate;
PROCEDURE EndScreenUpdate;
PROCEDURE ShowMouse;
PROCEDURE HideMouse;
END ManyWindows.